The present invention relates to a stream processing technique, and more particularly, to such technique for correcting a syntax error in an source encoded stream by substituting a macroblock(s) having the syntax error and/or a macroblock(s) which will not be parsed or variable-length-decoded correctly due to the syntax error with a predetermined macroblock(s) having a correct or acceptable syntax.
Several types of formats for recording a digital video signal on a recording medium and transmitting are available. However, since a digital video signal may have a relatively large amount of data, the video signal may be compression encoded so as to enable data corresponding to a relatively long playback period to be recorded on a recording medium. An example of a compression encoding method is a so-called MPEG (Moving Picture Image Coding Experts Group) method which is a hybrid method wherein motion-compensation predictive coding and discrete cosine transform (DCT) coding are combined. In other words, redundancy in the time domain is reduced by taking a difference between frames of a video signal and redundancy in the spatial domain is reduced by the use of discrete cosine transform (DCT) to efficiently encode the video signal.
In a video tape recorder (VTR), which uses a tape-shaped recording medium such as a magnetic tape recording medium, a recording process may be performed in which tracks disposed at an angle to a tape running direction (so-called helical tracks) are formed with the use of a rotating head. When such tape-shaped recording medium having helical tracks is reproduced at a speed higher than a normal tape running speed such as two times the normal speed (double speed) or three times the normal speed (triple speed) or such as that in a search function, since the trace angle of the rotating head on the tape becomes different from the angle of the recording tracks, all of the signals recorded in the helical tracks may not be reproduced. In other words, during high speed reproduction, the video tape recorder may not reproduce all data elements recorded in the helical tracks, and instead may only reproduce some of such data elements.
An arrangement of data elements (such as DCT coefficients) of a MPEG stream generated by a MPEG encoding method may not be suitable for recording or reproducing on or from a tape recording medium and high-speed reproducing by the video tape recorder. In other words, if a MPEG stream recorded on a tape recording medium is reproduced at a high-speed, the reproduced video stream may not have all of the data elements and, as a result of such reproduction, it may be difficult to obtain a high-quality image with an effective use of the reproduced stream.
Therefore, it may be preferable to use an encoded stream format which allows image reproduction to be performed effectively even in high-speed reproduction, instead of the MPEG encoded stream as a compression encoding method for a tape-shaped recording medium. In consideration thereof, a so called xe2x80x9cSX streamxe2x80x9d or xe2x80x9cBetacam-SX streamxe2x80x9d has been proposed which is suitable for high-speed reproduction.
The SX stream is generated by a SX encoder which utilizes a hybrid encoding technique which includes motion-compensation predictive coding and discrete cosine transform coding similar to that of the MPEG encoding method. Accordingly, the SX stream generated by the SX encoding method follows the MPEG standard. However, the SX stream and the MPEG stream differ in the arrangement of DCT coefficients in the encoded stream. Specifically, with regard to the DCT coefficients, to create a high quality image during high-speed reproduction, the DC element and AC elements having lower spatial frequency may be considered more important than the AC elements having higher spatial frequency. As a result, in the SX stream, AC elements of the DCT coefficients in the macroblock are rearranged in spatial frequency order from lower spatial frequency to higher spatial frequency.
Thus, although the SX stream is compliant with the MPEG standard, the SX stream is not the same as a MPEG stream and is suitable for high speed reproduction with a VTR.
When an encoded stream is to be transmitted to a MPEG device, it may be preferred to use a MPEG stream as the transmitting stream. On the other hand, when an encoded stream is to be recorded onto a tape medium, it may be preferred to use a SX stream as the recording stream. In consideration thereof, a stream processing apparatus for processing a source encoded stream so as to convert a stream structure from that of a MPEG stream to that of a SX stream or from that of a SX stream to that of a MPEG stream has been proposed. Such stream processing apparatus is described in U.S. patent application Ser. No. 09/283,034 filed Apr. 1, 1999 which is hereby incorporated by reference. When stream processing is performed on a source encoded stream by using such stream processing apparatus, it may be necessary to parse the syntax of the source encoded stream to extract the coding parameters.
However, if a syntax error occurred in the source encoded stream, the syntax of the source encoded stream will not be able to be correctly parsed or variable-length-decoded.
Such syntax error may occur when prohibitive coding parameters, non-determined coding parameters, or contradiction coding parameters are included in the source encoded stream. Also, when the source encoded stream includes data elements not corresponding to the variable encoding table, data elements which are interrupted, or data elements not having a predetermined data length, a syntax error may occur. As a result of the failure of the parsing or the variable-length-decoding process due to a syntax error, the above stream processing apparatus may not operate properly.
Furthermore, since a MPEG stream comprises a variable-length encoded (VLC) code stream, if a syntax error occurs in one respective macroblock in a slice layer, a plurality of macroblocks after the respective macroblock may not be properly parsed or variable-length-decoded.
An object of the present invention is to provide a stream processing technique which may properly process a source encoded stream regardless of a syntax error in a source parsing operation.
Another object of the present invention is to provide a stream processing technique as aforesaid wherein a macroblock having a syntax error is replaced by a macroblock having an acceptable or correct syntax.
A further object of the present invention is to provide a stream processing technique as aforesaid wherein the macroblock having a syntax error and a number of macroblocks which follow and/or precede the macroblock having the syntax error are replaced with macroblocks having an acceptable or correct syntax.
In accordance with an aspect of the present invention, a stream processing apparatus is provided which comprises a parsing device for parsing a syntax of a source encoded stream to extract a plurality of coding parameters from the source encoded stream, a detecting device for detecting an error macroblock having a syntax error in the source encoded stream in accordance with a result of a parsing process performed by the parsing device; a variable-length-decoding device for performing a variable-length-decoding process on the source encoded stream to generate a variable-length-decoded stream; a generating device for generating a predetermined macroblock having a correct syntax which conforms to a motion picture image coding experts group (MPEG) standard; and a substituting device for substituting the predetermined macroblock from the generating device for the error macroblock of the variable-length-decoded stream. A corresponding method is also provided.
In accordance with another aspect of the present invention, a stream processing apparatus is provided which comprises a parsing device for parsing a syntax of a source encoded stream to extract a plurality of coding parameters from the source encoded stream a detecting device for detecting an error layer having a syntax error in the source encoded stream in accordance with a result of a parsing process performed by the parsing device, a variable-length-decoding device for performing a variable-length-decoding process on the source encoded stream to generate a variable-length-decoded stream, a generating device for generating a predetermined layer having a correct syntax which conforms to a motion picture image coding experts group (MPEG) standard, and a substituting device for substituting the predetermined layer from the generating device for the error layer of the variable-length-decoded stream. A corresponding method is also provided.
Other objects, features and advantages of the present invention will become apparent form the following detailed description of the illustrated embodiments when read in conjunction with the accompanying drawings in which corresponding components are identified by the same reference numerals.